#!/bin/bash

# 获取当前目录并将其存储到变量中
CURRENT_DIR=$(pwd)

# 打印当前目录
echo "当前目录是: $CURRENT_DIR"

# 设定工作目录为
cd "$CURRENT_DIR"

# 切换到 `torch` 环境
source /root/miniconda3/bin/activate py310

# 检查 app.py 服务是否正在运行

ps -ef | grep pressure_index_v5.py | grep -v grep > /dev/null
if [ $? -eq 0 ]; then
    echo "pressure_index_v5.py is already running"
else
    echo "pressure_index_v5.py is not running, starting..."
    python "$CURRENT_DIR"/pressure_index_v5.py >> "$CURRENT_DIR"/pressure_index_v5.log 2>&1 &
    echo "pressure_index_v5.py is started"
fi